package com.ruoyi.opportunities.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.opportunities.mapper.BusinessOpportunitiesMapper;
import com.ruoyi.opportunities.domain.BusinessOpportunities;
import com.ruoyi.opportunities.service.IBusinessOpportunitiesService;

/**
 * 商机管理Service业务层处理
 * 
 * @author suoge
 * @date 2025-10-21
 */
@Service
public class BusinessOpportunitiesServiceImpl implements IBusinessOpportunitiesService 
{
    @Autowired
    private BusinessOpportunitiesMapper businessOpportunitiesMapper;

    /**
     * 查询商机管理
     * 
     * @param opportunityId 商机管理主键
     * @return 商机管理
     */
    @Override
    public BusinessOpportunities selectBusinessOpportunitiesByOpportunityId(Long opportunityId)
    {
        return businessOpportunitiesMapper.selectBusinessOpportunitiesByOpportunityId(opportunityId);
    }

    /**
     * 查询商机管理列表
     * 
     * @param businessOpportunities 商机管理
     * @return 商机管理
     */
    @Override
    public List<BusinessOpportunities> selectBusinessOpportunitiesList(BusinessOpportunities businessOpportunities)
    {
        return businessOpportunitiesMapper.selectBusinessOpportunitiesList(businessOpportunities);
    }

    /**
     * 新增商机管理
     * 
     * @param businessOpportunities 商机管理
     * @return 结果
     */
    @Override
    public int insertBusinessOpportunities(BusinessOpportunities businessOpportunities)
    {
        businessOpportunities.setCreateTime(DateUtils.getNowDate());
        return businessOpportunitiesMapper.insertBusinessOpportunities(businessOpportunities);
    }

    /**
     * 修改商机管理
     * 
     * @param businessOpportunities 商机管理
     * @return 结果
     */
    @Override
    public int updateBusinessOpportunities(BusinessOpportunities businessOpportunities)
    {
        businessOpportunities.setUpdateTime(DateUtils.getNowDate());
        return businessOpportunitiesMapper.updateBusinessOpportunities(businessOpportunities);
    }

    /**
     * 批量删除商机管理
     * 
     * @param opportunityIds 需要删除的商机管理主键
     * @return 结果
     */
    @Override
    public int deleteBusinessOpportunitiesByOpportunityIds(Long[] opportunityIds)
    {
        return businessOpportunitiesMapper.deleteBusinessOpportunitiesByOpportunityIds(opportunityIds);
    }

    /**
     * 删除商机管理信息
     * 
     * @param opportunityId 商机管理主键
     * @return 结果
     */
    @Override
    public int deleteBusinessOpportunitiesByOpportunityId(Long opportunityId)
    {
        return businessOpportunitiesMapper.deleteBusinessOpportunitiesByOpportunityId(opportunityId);
    }
}
